<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>用户权限管理系统</title>
		<!-- Tell the browser to be responsive to screen width -->
		<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
		<!-- Bootstrap 3.3.7 -->
		<link rel="stylesheet" href="__PUBLIC__/bower_components/bootstrap/dist/css/bootstrap.min.css">
		<!--bootstrapValidator-->
		<link rel="stylesheet" href="__PUBLIC__/bower_components/bootstrap-validator/dist/css/bootstrapValidator.min.css" />
		<!-- Font Awesome -->
		<link rel="stylesheet" href="__PUBLIC__/bower_components/font-awesome/css/font-awesome.min.css">
		<!-- Ionicons -->
		<link rel="stylesheet" href="__PUBLIC__/bower_components/Ionicons/css/ionicons.min.css">
		<!-- bootstrap datepicker -->
		<link rel="stylesheet" href="__PUBLIC__/bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
		<!-- DataTables -->
		<link rel="stylesheet" href="__PUBLIC__/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
		<!-- Theme style -->
		<link rel="stylesheet" href="__PUBLIC__/dist/css/AdminLTE.min.css">
		<!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
		<link rel="stylesheet" href="__PUBLIC__/dist/css/skins/_all-skins.min.css">

		<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
		<!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

		<!-- Google Font -->
		<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
		<style type="text/css">
			.dataTable {
				/*表格内容居中*/
				text-align: center;
			}
			
			#example1 th {
				/*数据表格标题文字居中*/
				text-align: center;
				vertical-align: middle!important;
			}
		</style>
	</head>

	<body class="hold-transition skin-blue sidebar-mini">
		<!-- Site wrapper -->
		<div class="wrapper">

			<header class="main-header">
				<!-- Logo -->
				<a href="#" class="logo">
					<!-- mini logo for sidebar mini 50x50 pixels -->
					<span class="logo-mini"><b>R</b>S</span>
					<!-- logo for regular state and mobile devices -->
					<span class="logo-lg"><b>Role</b>System</span>
				</a>
				<!-- Header Navbar: style can be found in header.less -->
				<nav class="navbar navbar-static-top">
					<!-- Sidebar toggle button-->
					<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
						<span class="sr-only">Toggle navigation</span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</a>

					<div class="navbar-custom-menu">
						<ul class="nav navbar-nav">
							<!-- Messages: style can be found in dropdown.less-->
							<li class="dropdown messages-menu">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown">
									<i class="fa fa-envelope-o"></i>
									<span class="label label-success">4</span>
								</a>
								<ul class="dropdown-menu">
									<li class="header">You have 4 messages</li>
									<li>
										<!-- inner menu: contains the actual data -->
										<ul class="menu">
											<li>
												<!-- start message -->
												<a href="#">
													<div class="pull-left">
														<img src="__PUBLIC__/dist/img/user3-128x128.jpg" class="img-circle" alt="User Image">
													</div>
													<h4>
                        Support Team
                        <small><i class="fa fa-clock-o"></i> 5 mins</small>
                      </h4>
													<p>Why not buy a new awesome theme?</p>
												</a>
											</li>
											<!-- end message -->
										</ul>
									</li>
									<li class="footer">
										<a href="#">See All Messages</a>
									</li>
								</ul>
							</li>
							<!-- Notifications: style can be found in dropdown.less -->
							<li class="dropdown notifications-menu">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown">
									<i class="fa fa-bell-o"></i>
									<span class="label label-warning">10</span>
								</a>
								<ul class="dropdown-menu">
									<li class="header">You have 10 notifications</li>
									<li>
										<!-- inner menu: contains the actual data -->
										<ul class="menu">
											<li>
												<a href="#">
													<i class="fa fa-users text-aqua"></i> 5 new members joined today
												</a>
											</li>
										</ul>
									</li>
									<li class="footer">
										<a href="#">View all</a>
									</li>
								</ul>
							</li>
							<!-- Tasks: style can be found in dropdown.less -->
							<li class="dropdown tasks-menu">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown">
									<i class="fa fa-flag-o"></i>
									<span class="label label-danger">9</span>
								</a>
								<ul class="dropdown-menu">
									<li class="header">You have 9 tasks</li>
									<li>
										<!-- inner menu: contains the actual data -->
										<ul class="menu">
											<li>
												<!-- Task item -->
												<a href="#">
													<h3>
                        Design some buttons
                        <small class="pull-right">20%</small>
                      </h3>
													<div class="progress xs">
														<div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
															<span class="sr-only">20% Complete</span>
														</div>
													</div>
												</a>
											</li>
											<!-- end task item -->
										</ul>
									</li>
									<li class="footer">
										<a href="#">View all tasks</a>
									</li>
								</ul>
							</li>
							<!-- User Account: style can be found in dropdown.less -->
							<li class="dropdown user user-menu">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown">
									<img src="__PUBLIC__/dist/img/user3-128x128.jpg" class="user-image" alt="User Image">
									<span class="hidden-xs">{$user}</span>
								</a>
								<ul class="dropdown-menu">
									<!-- User image -->
									<li class="user-header">
										<img src="__PUBLIC__/dist/img/user3-128x128.jpg" class="img-circle" alt="User Image">

										<p>
											{$user} - Web Developer
											<small>Member since Nov. 2012</small>
										</p>
									</li>
									<!-- Menu Body -->
									<li class="user-body">
										<div class="row">
											<div class="col-xs-4 text-center">
												<a href="#">Followers</a>
											</div>
											<div class="col-xs-4 text-center">
												<a href="#">Sales</a>
											</div>
											<div class="col-xs-4 text-center">
												<a href="#">Friends</a>
											</div>
										</div>
										<!-- /.row -->
									</li>
									<!-- Menu Footer-->
									<li class="user-footer">
										<div class="pull-right">
											<form method="post">
												<input type="hidden" name="info" id="info" value="exit" />
												<button type="submit" class="btn btn-danger">退出登录</button>
											</form>
										</div>
									</li>
								</ul>
							</li>
							<!-- Control Sidebar Toggle Button -->
						</ul>
					</div>
				</nav>
			</header>

			<!-- =============================================== -->

			<!-- Left side column. contains the sidebar -->
			<aside class="main-sidebar">
				<!-- sidebar: style can be found in sidebar.less -->
				<section class="sidebar">
					<!-- Sidebar user panel -->
					<div class="user-panel">
						<div class="pull-left image">
							<img src="__PUBLIC__/dist/img/user3-128x128.jpg" class="img-circle" alt="User Image">
						</div>
						<div class="pull-left info">
							<p>{$user}</p>
							<a href="#"><i class="fa fa-circle text-success"></i> Online</a>
						</div>
					</div>
					<!-- search form -->
					<form action="#" method="get" class="sidebar-form">
						<div class="input-group">
							<input type="text" name="q" class="form-control" placeholder="Search...">
							<span class="input-group-btn">
                <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
                </button>
              </span>
						</div>
					</form>
					<!-- /.search form -->
					<!-- sidebar menu: : style can be found in sidebar.less -->
					<ul class="sidebar-menu" data-widget="tree">
						<li class="header">主菜单</li>
					</ul>
				</section>
				<!-- /.sidebar -->
			</aside>

			<!-- =============================================== -->

			<!-- Content Wrapper. Contains page content -->
			<div class="content-wrapper">
				<!-- Content Header (Page header) -->
				<section class="content-header">
					<h1>用户信息</h1>
					<ol class="breadcrumb">
						<li>
							<button type="button" class="btn btn-primary " data-toggle="modal" data-target="#modal-default3">添加新用户</button>
						</li>
					</ol>
				</section>

				<!-- Main content -->
				<section class="content">
					<div class="row">
						<div class="col-xs-12">
							<div class="box">
								<div class="box-header">
									<!--<h3 class="box-title">用户信息表</h3>-->
								</div>
								<!-- /.box-header -->
								<div class="box-body">
									<table id="example1" class="table table-bordered table-striped">
										<thead>
											<tr>
												<th id="first">序号</th>
												<th>用户名</th>
												<th>昵称</th>
												<th>电话</th>
												<th id="last">操作</th>
											</tr>
										</thead>
										<tbody>
										</tbody>
										<tfoot>
											<tr>
												<th>序号</th>
												<th>用户名</th>
												<th>昵称</th>
												<th>电话</th>
												<th>操作</th>
											</tr>
										</tfoot>
									</table>
								</div>
								<!-- /.box-body -->
							</div>
							<!-- /.box -->
						</div>
						<!-- /.col -->
					</div>
					<!-- /.row -->
				</section>
				<!-- /.content -->
			</div>
			<!-- /.content-wrapper -->

			<footer class="main-footer">
				<div class="pull-right hidden-xs">
					<b>Version</b> 2.4.0
				</div>
				<strong>Copyright &copy; 2014-2016 <a href="https://adminlte.io">Almsaeed Studio</a>.</strong> All rights reserved.
			</footer>

			<!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
			<div class="control-sidebar-bg"></div>
		</div>
		<!-- ./wrapper -->
		<div class="modal fade" id="modal-default">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">×</span></button>
						<h4 class="modal-title">Default Modal1</h4>
					</div>
					<div class="modal-body">
						<form id="readForm" class="form-horizontal">
							<div class="box-body">
								<div class="form-group">
									<label for="username" class="col-sm-2 control-label">用户名</label>

									<div class="col-sm-10">
										<div class="input-group">
										<div class="input-group-addon">
												<i class="fa fa-user"></i>
											</div>
										<input type="email" disabled="disabled" class="form-control" name="readname" id="readname" value="">
									</div>
									</div>
								</div>
								<div class="form-group">
									<label for="nickname" class="col-sm-2 control-label">昵称</label>
									<div class="col-sm-10">
										<div class="input-group">
											<div class="input-group-addon">
												<i class="fa fa-smile-o"></i>
											</div>
											<input type="text" disabled="disabled" value="" class="form-control" name="readnick" id="readnick">
										</div>
									</div>
								</div>
								<div class="form-group">
									<label for="phone" class="col-sm-2 control-label">电话</label>
									<div class="col-sm-10">
										<div class="input-group">
											<div class="input-group-addon">
												<i class="fa fa-phone"></i>
											</div>
											<input type="text" disabled="disabled" value="" class="form-control" name="readphone" id="readphone" data-mask="">
										</div>
									</div>
								</div>
								<div class="form-group">
									<label for="datepicker" class="col-sm-2 control-label">生日</label>

									<div class="col-sm-10">
										<div class="input-group date">
											<div class="input-group-addon">
												<i class="fa fa-calendar"></i>
											</div>
											<input type="text" disabled="disabled" value="" name="birthday" class="form-control pull-right" id="readdatepicker">
										</div>
									</div>
								</div>
							</div>
							<!-- /.box-footer -->
						</form>

					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
					</div>
				</div>
				<!-- /.modal-content -->
			</div>
			<!-- /.modal-dialog -->
		</div>
		<div class="modal fade" id="modal-default2">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">×</span></button>
						<h4 class="modal-title">编辑</h4>
						<div class="pull-right col-sm-10 callout callout-success hide">
								<h4>保存成功！</h4>
								<p>成功修改用户信息！</p>
							</div>
							<div class="pull-right col-sm-10 callout callout-warning hide">
								<h4>保存失败！</h4>
								<p>信息未修改！</p>
							</div>
					</div>
						<form action="items" id="editForm" class="form-horizontal">
					<div class="modal-body">
							<div class="box-body">
								<div class="form-group">
									<label for="username" class="col-sm-2 control-label">用户名</label>

									<div class="col-sm-10">
										<div class="input-group">
										<div class="input-group-addon">
												<i class="fa fa-user"></i>
											</div>
										<input type="text" disabled="disabled" class="form-control" name="editname" id="editname" value="">
										<input type="hidden"  class="form-control" name="editid" id="editid" value="">
									</div>
									</div>
								</div>
								<div class="form-group">
									<label for="nickname" class="col-sm-2 control-label">昵称</label>
									<div class="col-sm-10">
										<div class="input-group">
											<div class="input-group-addon">
												<i class="fa fa-smile-o"></i>
											</div>
											<input type="text" value="" class="form-control" name="editnick" id="editnick">
										</div>
									</div>
								</div>
								<div class="form-group">
									<label for="phone" class="col-sm-2 control-label">电话</label>
									<div class="col-sm-10">
										<div class="input-group">
											<div class="input-group-addon">
												<i class="fa fa-phone"></i>
											</div>
											<input type="text" value="" class="form-control" name="editphone" id="editphone" data-mask="">
										</div>
									</div>
								</div>
								<div class="form-group">
									<label for="datepicker" class="col-sm-2 control-label">生日</label>

									<div class="col-sm-10">
										<div class="input-group date">
											<div class="input-group-addon">
												<i class="fa fa-calendar"></i>
											</div>
											<input type="text" value="" name="birthday" class="form-control pull-right" id="editdatepicker">
										</div>
									</div>
								</div>
							</div>
							<!-- /.box-footer -->
						
	
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
						<button type="button" id="tijiao" class="btn btn-primary">保存</button>
					</div>
					</form>
				</div>
				<!-- /.modal-content -->
			</div>
			<!-- /.modal-dialog -->
		</div>
		<div class="modal fade" id="modal-default3">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">×</span></button>
						<h4 class="modal-title">请填写信息</h4>
						<div class="pull-right-container col-sm-10 callout callout-success hide">
								<h4>添加成功！</h4>
								<p>成功添加用户信息！</p>
							</div>
							<div class="pull-right-container col-sm-10 callout callout-warning hide">
								<h4>添加失败！</h4>
								<p>用户名已存在！</p>
							</div>
					</div>
					<div class="modal-body">
						<form id="infoForm" class="form-horizontal">
							<div class="box-body">
								<div class="form-group">
									<label for="username" class="col-sm-2 control-label">用户名</label>

									<div class="col-sm-10">
										<div class="input-group">
											<div class="input-group-addon">
												<i class="fa fa-user"></i>
											</div>
											<input type="text" class="form-control" name="username" id="username" value="" placeholder="请输入用户名">
										</div>
									</div>
								</div>
								<div class="form-group">
									<label for="nickname" class="col-sm-2 control-label">昵称</label>
									<div class="col-sm-10">
										<div class="input-group">
											<div class="input-group-addon">
												<i class="fa fa-smile-o"></i>
											</div>
											<input type="text" value="" class="form-control" name="nickname" id="nickname" placeholder="请输入昵称">
										</div>
									</div>
								</div>
								<div class="form-group">
									<label for="newpass" class="col-sm-2 control-label">密码</label>
									<div class="col-sm-10">
										<div class="input-group">
											<div class="input-group-addon">
												<i class="fa fa-eye-slash"></i>
											</div>
											<input type="password" value="" class="form-control" name="newpass" id="newpass">
										</div>
									</div>
								</div>
								<div class="form-group">
									<label for="repass" class="col-sm-2 control-label">确认密码</label>
									<div class="col-sm-10">
										<div class="input-group">
											<div class="input-group-addon">
												<i class="fa fa-eye-slash"></i>
											</div>
											<input type="password" value="" class="form-control" name="repass" id="repass">
										</div>
									</div>
								</div>
								<div class="form-group">
									<label for="phone" class="col-sm-2 control-label">电话</label>
									<div class="col-sm-10">
										<div class="input-group">
											<div class="input-group-addon">
												<i class="fa fa-phone"></i>
											</div>
											<input type="text" value="" class="form-control" name="phone" id="phone" data-mask="" placeholder="请填写电话号码">
										</div>
									</div>
								</div>
								<div class="form-group">
									<label for="datepicker" class="col-sm-2 control-label">生日</label>
									<div class="col-sm-10">
										<div class="input-group date">
											<div class="input-group-addon">
												<i class="fa fa-calendar"></i>
											</div>
											<input type="text" value="" name="birthday" class="form-control pull-right" id="datepicker">
										</div>
									</div>
								</div>
							</div>
							<!-- /.box-body -->
							<div class="box-footer">
								<button id="btnadd" type="submit" class="btn btn-info pull-right">保存</button>

							</div>
							<!-- /.box-footer -->
						</form>

					</div>
				</div>
				<!-- /.modal-content -->
			</div>
			<!-- /.modal-dialog -->
		</div>

		<script src="__PUBLIC__/bower_components/jquery/dist/jquery.min.js"></script>
		<!-- Bootstrap 3.3.7 -->
		<script src="__PUBLIC__/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
		<!--bootstrap-validator-->
		<script src="__PUBLIC__/bower_components/bootstrap-validator/dist/js/bootstrapValidator.min.js"></script>
		<!-- InputMask -->
		<script src="__PUBLIC__/plugins/input-mask/jquery.inputmask.js"></script>
		<script src="__PUBLIC__/plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
		<script src="__PUBLIC__/plugins/input-mask/jquery.inputmask.extensions.js"></script>
		<!-- bootstrap datepicker -->
		<script src="__PUBLIC__/bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
		<script src="__PUBLIC__/bower_components/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-CN.js"></script>
		<!-- DataTables -->
		<script src="__PUBLIC__/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
		<script src="__PUBLIC__/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
		<!-- SlimScroll -->
		<script src="__PUBLIC__/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
		<!-- FastClick -->
		<script src="__PUBLIC__/bower_components/fastclick/lib/fastclick.js"></script>
		<!-- AdminLTE App -->
		<script src="__PUBLIC__/dist/js/adminlte.min.js"></script>
		<!-- AdminLTE for demo purposes -->
		<script src="__PUBLIC__/dist/js/demo.js"></script>
		<script src="__PUBLIC__/js/LoadMenu.js"></script>
		<script>
			$(document).ready(function() {
				$('.sidebar-menu').tree();
				$('.treeview:nth-child(3)').addClass('active');
				$('.treeview:nth-child(3)').addClass('menu-open');
				$('.treeview:nth-child(3) .treeview-menu').css('display', 'block');
				$('.treeview:nth-child(3) .treeview-menu li:nth-child(1)').addClass('active');
				$('#example1').DataTable({
					"order": [
						[1, 'asc']
					],
					"columnDefs": [{
						"orderable": false,
						"targets": [0, 4]
					}],

					//开启服务器模式
					"processing": true,
					"serverSide": true,
					"language": {
						"sProcessing": "处理中...",
						"sLengthMenu": "显示 _MENU_ 项结果",
						"sZeroRecords": "没有匹配结果",
						"sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
						"sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
						"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
						"sInfoPostFix": "",
						"sSearch": "搜索:",
						"sUrl": "",
						"sEmptyTable": "表中数据为空",
						"sLoadingRecords": "载入中...",
						"sInfoThousands": ",",
						"oPaginate": {
							"sFirst": "首页",
							"sPrevious": "上页",
							"sNext": "下页",
							"sLast": "末页"
						},
						"oAria": {
							"sSortAscending": ": 以升序排列此列",
							"sSortDescending": ": 以降序排列此列"
						}
					},
					"ajax": '/home/user/serverdblist',
					"columns": [{
							"width": "10%"
						},
						{
							"width": "20%"
						},
						{
							"width": "20%"
						},
						{
							"width": "20%"
						},
						{
							"width": "30%"
						}
					]
				});
				$('[data-mask]').inputmask();
				$('#datepicker').inputmask('yyyy-mm-dd', {
					'placeholder': 'yyyy-mm-dd'
				})
				$('#editdatepicker').inputmask('yyyy-mm-dd', {
					'placeholder': 'yyyy-mm-dd'
				})
				$('#readdatepicker').inputmask('yyyy-mm-dd', {
					'placeholder': 'yyyy-mm-dd'
				})
				$('#datepicker').datepicker({
					autoclose: true,
					orientation: "bottom auto",
					language: "zh-CN",
					todayHighlight: true,
				})
				$('#editdatepicker').datepicker({
					autoclose: true,
					orientation: "bottom auto",
					language: "zh-CN",
					todayHighlight: true,
				})
				$('#infoForm').bootstrapValidator({
					message: 'This value is not valid',
					feedbackIcons: {
						valid: 'glyphicon glyphicon-ok',
						invalid: 'glyphicon glyphicon-remove',
						validating: 'glyphicon glyphicon-refresh'
					},
					fields: {
						phone: {
							validators: {
								notEmpty: {
									message: '手机号不能为空'
								},
								regexp: {
									regexp: /^1[3|4|5|7|8][0-9]{9}$/,
									message: '电话号码格式错误'
								}
							}
						},
						username: {
							validators: {
								notEmpty: {
									message: '用户名不能为空'
								}
							}
						},
						newpass: {
							validators: {
								notEmpty: {
									message: '密码不能为空'
								},
								stringLength: {
									min: 6,
									max: 16,
									message: '请输入6-16位密码'
								},
							}
						},
						repass: {
							validators: {
								notEmpty: {
									message: '请确认密码'
								},
								identical: {
									field: 'newpass',
									message: '与新密码不匹配'
								}
							}
						},
						
					}
				}).on('success.form.bv', function(e) {
					// 取消默认事件操作
					e.preventDefault();
					// 获取当前提交的表单对象
					var $form = $(e.target);
					// 获取提交的数据
					var bv = $form.data('bootstrapValidator');
					// Use Ajax to submit form data
					$.post($form.attr('action'), $form.serialize(), function(result) {
						console.log(result.code)
						if(result.code == 0) {
							$(".callout-success").removeClass("hide")
							$(".callout-warning").addClass("hide")
							$("#btnadd").removeAttr("disabled")
						} else {
							$(".callout-warning").removeClass("hide")
							$(".callout-success").addClass("hide")
							$("#btnadd").removeAttr("disabled")
						};
					}, 'json');
				});
				$('#editForm').bootstrapValidator({
					message: 'This value is not valid',
					feedbackIcons: {
						valid: 'glyphicon glyphicon-ok',
						invalid: 'glyphicon glyphicon-remove',
						validating: 'glyphicon glyphicon-refresh'
					},
					fields: {
						editphone: {
							validators: {
								notEmpty: {
									message: '手机号不能为空'
								},
								regexp: {
									regexp: /^1[3|4|5|7|8][0-9]{9}$/,
									message: '电话号码格式错误'
								}
							}
						},
						editname: {
							validators: {
								notEmpty: {
									message: '用户名不能为空'
								},
								regexp: {
									regexp: /^[a-z0-9_]{3,16}$/,
									message: '用户名只能由数字，字母，和下划线组成，且不能小于3位字符，不能大于16位字符'
								},
							}
						},
					}
				}).on('success.form.bv', function(e) {
					// 取消默认事件操作
					e.preventDefault();
					// 获取当前提交的表单对象
					var $form = $(e.target);
					// 获取提交的数据
					var bv = $form.data('bootstrapValidator');
					// Use Ajax to submit form data
					$.post($form.attr('action'), $form.serialize(), function(result) {
					}, 'json');
				});
				$('#example1').on("click",".edit",function(){
					var sid=$(this).attr('data-id')
					var sedit=$(this).attr('data-edit')
					$.ajax({
						type:"post",
						url:"/home/user/items",
						data:{
							id:sid,
							edit:sedit,
						},
						success:function(data){
							$('#editname').val(data[0]['username']);
							$('#editphone').val(data[0]['phone']);
							$('#editaddress').val(data[0]['address']);
							$('#editdatepicker').val(data[0]['birthday']);
							$('#editnick').val(data[0]['nickname']);
							$('#editid').val(data[0]['id']);
						}
					});
				})
				$('#example1').on("click",".read",function(){
					var sid=$(this).attr('data-id')
					var sread=$(this).attr('data-read')
					$.ajax({
						type:"post",
						url:"/home/user/items",
						data:{
							id:sid,
							read:sread,
						},
						success:function(data){
							$('#readname').val(data[0]['username']);
							$('#readphone').val(data[0]['phone']);
							$('#readaddress').val(data[0]['address']);
							$('#readdatepicker').val(data[0]['birthday']);
							$('#readnick').val(data[0]['nickname']);
//							$('#readid').val(data[0]['id']);
						}
					});
				})
				$("#tijiao").on("click",function(){
					var editname=$('#editname').val();
					var editphone=$('#editphone').val();
					var editaddress=$('#editaddress').val();
					var editdatepicker=$('#editdatepicker').val();
					var editnick=$('#editnick').val();
					var editid=$('#editid').val();
					$.ajax({
						type:"post",
						url:"/home/user/items",
						data:{
							ename:editname,
							ephone:editphone,
							eaddress:editaddress,
							ebirthday:editdatepicker,
							enick:editnick,
							eid:editid,
						},
						success:function(data){
							console.log(data)
							if(data.code == 0) {
								$(".callout-success").removeClass("hide")
								$(".callout-warning").addClass("hide")
								$("#btnadd").removeAttr("disabled")
								location.href="/home/user/items"
							} else {
								$(".callout-warning").removeClass("hide")
								$(".callout-success").addClass("hide")
								$("#btnadd").removeAttr("disabled")
							};
						}
					});
				})
				$('#example1').on("click","#del",function(){
					var sid=$(this).attr('data-id')
					var sdel=$(this).attr('data-del')
					$.ajax({
						type:"post",
						url:"/home/user/items",
						data:{
							id:sid,
							del:sdel,
						},
						success:function(data){
							if(data==1){
								location.href='/home/user/items'
							}
						}
						
					});
				})
			})
		</script>
	</body>

</html>